<?php
require 'user.php';
require 'function.php';
$type=$_POST['type'];
if($type=="diff"||$type=="proplist") header("location:$type.php?path={$_POST[selected][0]}");
elseif(in_array($_POST['type'],array('branch','checkout','update','commit','cleanup','status','switch','resolve','log'))) header("location:$_POST[type].php?path=$_POST[path]");
elseif($_POST['type']=='upload') {
header('Location: upload.php?path='.$_POST['path']);
}
elseif($_POST['type']=='urlupload') {
header('Location: urlupload.php?path='.$_POST['path']);
}
elseif($_POST['type']=='mkdir') {
header('Location: mkdir.php?path='.$_POST['path']);
}
elseif($_POST['type']=='mkfile') {
header('Location: mkfile.php?path='.$_POST['path']);
}
elseif($_POST['type']=='add'||$_GET['type']=='revert') {
if($type=="add")
 $_SESSION['path']=$_POST['selected'];
include './add.php';

}
elseif($_POST['type']=='delete' || $type=="revert_tip") {
$_SESSION['path']=$_POST['selected'];
header('Content-Type: text/html;charset=UTF-8');
$is=($type=="delete");
$tip_a=$is ? "文件管理 删除提示" : "SVN 撤销更改";
$tip_b=$is ? "(警)数据删除将不能复原" : "撤销更改将会使你的修改丢失（还原到最后一次更新的样子）。如果文件没有被修改，而是刚刚被添加到版本库，则它们会被移出版本库（但文件不会被删除）。你确定要这么做吗？";
echo <<<HTML
<html>
<head>
<title>$tip_a</title>
<style type="text/css">
.big_board{background-color:#009BCE;color:#FFF;}
.board_title{margin-bottom:1px;border:1px solid #09F;}
</style>
</head>
<body>
<div class="big_board"><div class="board_title">爱特文管－路径信息</div></div>
HTML;
echo '<a href="index.php?path='.$_GET['path'].'">'.realpath(_decode($_GET['path'])).'</a>';
echo <<<HTML
<div class="big_board"><div class="board_title">$tip_b</div></div>
HTML;
if(count($_SESSION['path'])>0) {
if($is){
echo '[<a href="delete.php?svn=1&amp;path='.$_GET['path'].'">SVN删除</a>]';
echo '[<a href="delete.php?svn=2&amp;path='.$_GET['path'].'">SVN强制删除</a>]';
echo '[<a href="delete.php?path='.$_GET['path'].'">直接删除</a>]<br/>（可能会连接超时。如果超时，<a href="status.php?path='.$_GET['path'].'&amp;onlyshow=1">点击这里查看提交结果</a>）';
}else{
echo '[<a href="system.php?path='.$_GET['path'].'&amp;type=revert">确定操作</a>]<br/>（可能会连接超时。如果超时，<a href="status.php?path='.$_GET['path'].'&amp;onlyshow=1">点击这里查看提交结果</a>）';
}
} else {
echo 'Hello,待操作文件为空!';
}
foreach($_SESSION['path'] as $ipath) {
echo <<<HTML
<div class="big_board"><div class="board_title"></div></div>
HTML;
echo basename($ipath=_decode($ipath));
if(is_dir($ipath))

 echo '/';
}
echo <<<HTML
<div class="big_board"><div class="board_title">By：Admin@Lspecial.Com</div></div>
HTML;
}
elseif($_POST['type']=='pkzip') {
$_SESSION['path']=$_POST['selected'];
header('Content-Type: text/html; charset=UTF-8');
echo <<<HTML
<html>
<head>
<title>文件管理－压缩数据</title>
<style type="text/css">
.big_board{background-color:#009BCE;color:#FFF;}
.board_title{margin-bottom:1px;border:1px solid #09F;}
</style>
</head>
<body>
<div class="big_board"><div class="board_title">爱特文管－路径信息</div></div>
HTML;
echo '<a href="index.php?path='.$_GET['path'].'">'.realpath(_decode($_GET['path'])).'</a>';
echo <<<HTML
<div class="big_board"><div class="board_title">压缩数据－存档名称</div></div>
HTML;
if(count($_SESSION['path'])>0) {
echo <<<HTML
<form action="pkzip.php?path={$_GET['path']}" method="post">
<input type="text" name="pkname" value=".zip"/>
<input type="submit" value="压缩"/>
</form>
HTML;
} else {
echo 'Hello,待操作文件为空!';
}
foreach($_SESSION['path'] as $ipath) {
echo <<<HTML
<div class="big_board"><div class="board_title"></div></div>
HTML;
echo basename($ipath=_decode($ipath));
if(is_dir($ipath))
 echo '/';
}
echo <<<HTML
<div class="big_board"><div class="board_title">By：Admin@Lspecial.Com</div></div>
HTML;
}
elseif($_POST['type']=='move') {
$_SESSION['path']=$_POST['selected'];
header('Content-Type: text/html; charset=UTF-8');
echo <<<HTML
<html>
<head>
<title>文件管理－批量移动</title>
<style type="text/css">
.big_board{background-color:#009BCE;color:#FFF;}.board_title{margin-bottom:1px;border:1px solid #09F;}
</style>
</head>
<body>
<div class="big_board"><div class="board_title">爱特文管－路径信息</div></div>
HTML;
echo '<a href="index.php?path='.$_GET['path'].'">',$path=realpath(_decode($_GET['path'])),'</a>';
echo <<<HTML
<div class="big_board"><div class="board_title">移动操作－目标目录</div></div>
HTML;
if(count($_SESSION['path'])>0) {echo <<<HTML
<form action="move.php?path={$_GET['path']}" method="post">
<input type="text" name="dir" value="$path"/><br/>
<input type="submit" name="svn" value="SVN操作"/><input type="checkbox" name="force" value="1"/>强制操作<br/><input type="submit" value="直接操作"/><input type="checkbox" name="copy" value="1"/>复制<br/>（可能会连接超时。如果超时，<a href="status.php?path=$_GET[path]&amp;onlyshow=1">点击这里查看提交结果</a>）</form>
HTML;
} else {
echo 'Hello,待操作文件为空!';
}
foreach($_SESSION['path'] as $ipath) {echo <<<HTML
<div class="big_board"><div class="board_title"></div></div>
HTML;
echo basename($ipath=_decode($ipath));
if(is_dir($ipath))
 echo '/';
}

echo <<<HTML
<div class="big_board"><div class="board_title">By：Admin@Lspecial.Com</div></div>
HTML;
}elseif($_POST['type']=='rename') {
$_SESSION['path']=$_POST['selected'];
header('Content-Type: text/html; charset=UTF-8');
echo <<<HTML
<html>
<head>
<title>文件管理－批量重命名</title>
<style type="text/css">
.big_board{background-color:#009BCE;color:#FFF;}.board_title{margin-bottom:1px;border:1px solid #09F;}
</style>
</head>
<body>
<div class="big_board"><div class="board_title">爱特文管－路径信息</div></div>
HTML;
echo '<a href="index.php?path='.$_GET['path'].'">',$path=realpath(_decode($_GET['path'])),'</a>';
echo <<<HTML
<div class="big_board"><div class="board_title">重命名－目标文件</div></div>
HTML;
if(count($_SESSION['path'])>0) {
echo <<<HTML
<form action="rename.php?path={$_GET['path']}" method="post">
保存目录:<input name="dir" value="$path"/><br/>
HTML;
foreach($_SESSION['path'] as $fn)
{
$fn=basename(_decode($fn));
echo <<<HTML
$fn<input type="text" name="file[]" value="$fn"/><br/>
HTML;
}
echo <<<HTML
<input type="submit" name="svn" value="SVN操作"/><input type="checkbox" name="force" value="1"/>强制操作<br/><input type="submit" value="直接操作"/><input type="checkbox" name="copy" value="1"/>复制<br/>（可能会连接超时。如果超时，<a href="status.php?path=$_GET[path]&amp;onlyshow=1">点击这里查看提交结果</a>）
</form>
HTML;
} else {
echo 'Hello,待操作文件为空!';
}
/*foreach($_SESSION['path'] as $ipath) {echo <<<HTML
<div class="big_board"><div class="board_title"></div></div>
HTML;
echo basename($ipath=_decode($ipath));
if(is_dir($ipath))
 echo '/';
}*/

echo <<<HTML
<div class="big_board"><div class="board_title">By：Admin@Lspecial.Com</div></div>
HTML;
}
?>